#include <iostream>
#include <functional>
using std::ref;

void f(int& r)
{
    ++r;
}
template< class F, class T>
void g(F f, T t)
{
    f(t);
}
int main()
{
    int i = 0;
    g(f, i);
    std::cout << i << std::endl;

    g(f, ref(i));
    std::cout << i << std::endl;
}
